#include<p18f4550.h>
#include<plib/Delays.h>
#pragma config FOSC=XT_XT, FCMEN=OFF, IESO=OFF, CPUDIV=OSC1_PLL2
#pragma config PWRT=ON, BOR=OFF, BORV=0, WDT=OFF, WDTPS=32768
#pragma config MCLRE=ON, LPT1OSC=OFF, PBADEN=OFF, CCP2MX=OFF
#pragma config STVREN=OFF, LVP=OFF, XINST=OFF, DEBUG=OFF
#pragma config CP0=OFF, CP1=OFF, CP2=OFF, CPB=OFF, CPD=OFF
#pragma config WRT0=OFF, WRT1=OFF, WRT2=OFF
#pragma config WRTB=OFF, WRTC=OFF, WRTD=OFF
#pragma config EBTR0=OFF, EBTR1=OFF, EBTR2=OFF, EBTRB=OFF
void main(){
    TRISA=3;
    TRISB=0;
    ADCON1=15;
    while(1)
        
    {
        if((PORTA&1)==0){
        for(int a=100;a<=180;a++){
    PORTBbits.RB2=1;
    Delay10TCYx(a);
    PORTBbits.RB2=0;
    Delay10KTCYx(5);
        }
    Delay1KTCYx(5);

    for(int a=50;a<130;a++){
    PORTBbits.RB0=1;
    Delay10TCYx(a);
    PORTBbits.RB0=0;
    Delay10KTCYx(5);
           }
    Delay1KTCYx(5);
    for(int a=50;a<=230;a++){
    PORTBbits.RB1=1;
    Delay10TCYx(a);
    PORTBbits.RB1=0;
    Delay10KTCYx(5);
           }
    Delay1KTCYx(5);
    

    }else{int b=0;; /*if((PORTA&1)==1){
        for(int a=0;a<=3;a++){
    PORTBbits.RB0=1;
    Delay10TCYx(76);
    PORTBbits.RB0=0;
    Delay10KTCYx(5);
        }
    Delay1KTCYx(5);
      for(int a=0;a<=3;a++){
    PORTBbits.RB1=1;
    Delay10TCYx(76);
    PORTBbits.RB1=0;
    Delay10KTCYx(5);
        }
    Delay1KTCYx(5);
      for(int a=0;a<=3;a++){
    PORTBbits.RB3=1;
    Delay10TCYx(76);
    PORTBbits.RB3=0;
    Delay10KTCYx(5);
        }
   Delay1KTCYx(5);
      for(int a=0;a<=3;a++){
    PORTBbits.RB4=1;
    Delay10TCYx(76);
    PORTBbits.RB4=0;
    Delay10KTCYx(5);
        }
   Delay1KTCYx(5);*/
}
    }
       }
